﻿using BLL;
using Common;
using IBLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 考试管理系统
{
    public partial class FmChangePassword : Form
    {
        IUpdatePassword_IBLL update=new UpdatePassword_BLL();
        public FmChangePassword()
        {
            InitializeComponent();
        }

        private void uiTextBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void uiButton1_Click(object sender, EventArgs e)
        {
            if (uiTextBox1.Text.Trim() != login_Com.account.password)
            {
                MessageBox.Show("原密码不正确", "温馨提示", MessageBoxButtons.OK);
                return;
            }
            try
            {
                if (update.UpdatePassword(login_Com.account.password))
                {
                    MessageBox.Show("密码修改成功","温馨提示",MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("密码修改失败,请检查新密码格式是否正确","温馨提示",MessageBoxButtons.OK,MessageBoxIcon.Question);
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show("密码修改失败 报错异常: "+ex.Message);
            }
        }

        private void uiButton2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
